package com.suray.wcs.service.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * @author rbj
 */

public enum PlcType implements IEnum<Integer> {
    /**
     * 松下提升机
     */
    PANASONIC(1, "松下提升机"),
    /**
     * 西门子提升机
     */
    SIEMENS(2, "西门子提升机"),
    /**
     * 托盘线
     */
    STATION(3, "托盘线"),

    REMARK(4, "其他"),

    TAMAGAWA(5, "多摩川提升机"),

    AUTOMATIC_LIFTER(6, "自卸式提升机"),

    FORK_LIFTER(7, "货叉式提升机");
    @EnumValue
    private Integer plcType;
    @JsonValue
    private String description;

    PlcType(int plcType, String description) {
        this.plcType = plcType;
        this.description = description;
    }

    @Override
    public String toString() {
        return description;
    }

    @Override
    public Integer getValue() {
        return plcType;
    }


    public static PlcType parsePlcType(int plcType) {
        PlcType[] Types = PlcType.values();
        for (PlcType type : Types) {
            if (type.plcType == plcType) {
                return type;
            }
        }
        throw new IllegalArgumentException("PLC类型参数错误:" + plcType);
    }
}
